package gr.uoa.di.thanos.botcraft.game;

import java.util.UUID;

/**
 * This abstract class represents a game object
 * @author thanos.papapetrou@gmail.com
 *
 */
public abstract class Object {
	protected final UUID id;
	protected Vector position;
	protected Vector orientation;
	
	/**
	 * Construct a new object.
	 * @param id the object identifier
	 * @param position the object position
	 * @param orientation the object orientation
	 */
	protected Object(final UUID id, final Vector position, final Vector orientation) {
		if (id == null)
			throw new IllegalArgumentException(Object.class.getName() + " ID can not be null");
		if (position == null)
			throw new IllegalArgumentException(Object.class.getName() + " position can not be null");
		if (orientation == null)
			throw new IllegalArgumentException(Object.class.getName() + " orientation can not be null");
		this.id = id;
		this.position = position;
		this.orientation = orientation;
	}
	
	/**
	 * Get the object identifier.
	 * @return the object identifier
	 */
	public UUID getId() {
		return id;
	}
	
	/**
	 * Get the object position.
	 * @return the object position
	 */
	public Vector getPosition() {
		return position;
	}
	
	/**
	 * Get the object orientation.
	 * @return the object orientation
	 */
	public Vector getOrientation() {
		return orientation;
	}
	
	@Override
	public boolean equals(final java.lang.Object object) {
		return (object instanceof Object) && id.equals(((Object) object).id);
	}
		
	@Override
	public int hashCode() {
		return id.hashCode();
	}

	@Override
	public String toString() {
		return id.toString();
	}
}
